<template>
  <div>
    <div class="uploadSource" v-if="imgSrc">
      <label class="statusLabel curs" @mouseenter="mouseenter" @mouseleave="mouseleave">
        <i class="el-icon-check" ref="imgicon"></i>
        <i class="el-icon-close" @click="delIcon"></i>
      </label>
      <img :src="imgSrc" @click="upLoad" class="wid" />
    </div>
    <div v-else class="uploadSource flex-center curs" @click="upLoad">
      <i class="el-icon-plus fon_40 color_d9"></i>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    upSuccess: Function,
    keyName: String,
    imgSrc: {
      type: String,
      default: ''
    }
  },
  data() {
    return {};
  },
  methods: {
    upLoad() {
      this.$emit('click');
    },
    mouseleave() {
      this.$refs.imgicon.style.display = 'inline-block';
    },
    mouseenter() {
      this.$refs.imgicon.style.display = 'none';
    },
    delIcon() {
      this.$emit('close');
    }
  }
};
</script>

<style lang="scss" scoped>
.uploadSource .statusLabel {
  background: #fff;
  position: absolute;
  display: block;
  right: -17px;
  top: -7px;
  width: 46px;
  height: 26px;
  text-align: center;
  transform: rotate(45deg);
  box-shadow: 0 1px 1px #ccc;
  overflow: hidden;
}

.statusLabel .el-icon-check {
  width: 100%;
  height: 100%;
  color: #fff;
  background: #13ce66;
  font-size: 12px;
}

.statusLabel .el-icon-close {
  /* display: none; */
  margin-top: 12px;
  transform: rotate(-45deg);
  cursor: pointer;
  opacity: 1;
  color: #606266;
  background: #fff;
  position: relative;
  top: -2px;
}
</style>